package com.plus.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description 异常返回码定义枚举
 */
public enum ErrorCode {

    /**
     * 系统异常
     */
    SYSTEM_EXCEPTION("500", "系统异常"),

    /**
     * 参数为空
     */
    TOKEN_EXPIRED("302", "参数为空");


    /**
     * 获取所有状态
     *
     * @return
     */
    public static Map<String, String> getAllState() {
        ErrorCode[] sts = ErrorCode.values();
        Map<String, String> maps = new HashMap();
        for (ErrorCode tmp : sts) {
            maps.put(tmp.errorCode, tmp.errorMessage);
        }
        return maps;
    }



    private String errorCode;

    private String errorMessage;


    //region get/set
    /**
     * @param errorCode
     * @param errorMessage
     */
    private ErrorCode(String errorCode, String errorMessage) {
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    /**
     * @return the errorCode
     */
    public String getErrorCode() {
        return errorCode;
    }

    /**
     * @param errorCode the errorCode to set
     */
    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }

    /**
     * @return the errorMessage
     */
    public String getErrorMessage() {
        return errorMessage;
    }

    /**
     * @param errorMessage the errorMessage to set
     */
    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
    //endregion


}
